package File;

import java.io.File;

/*删除文件或目录*/
public class DeletFileDemo {
    public static void main(String[] args) {
        /*File file = new File("./demo.txt");*/
        /*if (file.exists()){
            file.delete();
            System.out.println("文件已删除");
        }else {
            System.out.println("文件不存在");
        }*/

        for (int i = 1;i<=10;i++){
            File file = new File("test"+i+".txt");
            if (file.exists()){
                file.delete();
                System.out.println("文件已删除");
            }else {

                System.out.println("文件不存在");
            }
        }
    }
}
